﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="RecruitingApplication.ApplicationView.ApplicationView" %>

<%@ Register Src="~/Controls/DocsNotes/DocsControl.ascx" TagPrefix="DC" TagName="DocsControl" %>


<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">

    <link href="<%= this.ResolveUrl("~/Styles/CandidatePage.css") %>" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="<%= this.ResolveUrl("~/Scripts/JQUI/jquery.ui.tabs.js") %>" ></script>
    <script type="text/javascript" src="<%= this.ResolveUrl("~/Scripts/jquery.form.js") %>" ></script>
    <script type="text/javascript" src="<%= this.ResolveUrl("~/Scripts/CandidatePage.js") %>" ></script>

    <script type="text/javascript">
        CP_IsCandSet = <%= IsCandSet.ToString().ToLower() %>;
        CP_ApplicationsCount = <%= AppsCount %>;
        CP_HeardAboutNotes = '<%= Notes %>';
        CP_CandidateID = <%= CandID %>;
        CP_CandidateName = '<%= Name %>';
        CP_HeardAbout = '<%= HeardAbout %>';
        CP_CandidateEmail = '<%= Email %>';
        CP_CandidatePhone = '<%= Phone %>';
        CP_HeardAboutID = <%= HeardAboutID %>;
        DOWNLOAD_PAGE_URL = '<%= ResolveUrl("~/Services/Download.ashx") %>';
    </script>


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
   
    <div>
        <span id="NoCandidateMsg" class="ui-state-error-text ui-helper-hidden">
            Error: No candidate specified.
        </span>
    </div>

    <div id="CandidateInfo" class="ui-widget">
        <div style="margin-bottom: 10px;">
            <span id="CandidateInfoName"><%= Name %></span>
        </div>

        <table style="margin: auto">
            <tr>
                <td>
                    <span id="CandidateInfoEmail">
                        <a href="mailto:<%= Email %>" id="MailTo"><%= Email %></a>
                    </span>
                </td>
                <td>
                    <div class="CandidateInfoSpacer">
                        <span class="ui-icon ui-icon-bullet"></span>
                    </div>
                </td>
                <td>
                    <span id="CandidateInfoPhone"><%= Phone %></span>
                </td>
                <td>
                    <div class="CandidateInfoSpacer">
                        <span class="ui-icon ui-icon-bullet"></span>
                    </div>
                </td>
                <td>
                    <span>Heard About Us Via: </span>
                    <span id="CandidateInfoHeardAbout"><%= HeardAbout %></span>
                </td>
                <td>
                    <div id="CandidateInfoNotesIcon" class="ui-helper-hidden" title="<%= Notes %>">
                        <span class="ui-icon ui-icon-info"></span>
                    </div>
                </td>
            </tr>
        </table>
    </div>

    <div id="ButtonHolder">
        <button id="AddNewApplicationButton">Add New Application</button>
        <button id="EditCandidate">Edit</button>
    </div>

    <div style="margin-top: 5px;">
        <span id="NoApplicationsMsg" class="ui-state-highlight ui-helper-hidden">
            No applications were found for this candidate. Click above to add an application.
        </span>
    </div>

    <br />
    <div id="tabs">
        <%-- This is tricky, we will use two Repeaters bound to exactly the same data.
             This way, we can generate a tab for each application 
             as well as a body for each application --%>
        <ul>
            <asp:Repeater runat="server" ID="TabsRepeater">
                <ItemTemplate>
                    <%-- each item in the here will be a tab, or li --%>
                    <li><a href='#tab<%# Eval("ID") %>'><%# Eval("DateApplied") %></a></li>
                </ItemTemplate>
            </asp:Repeater>
        </ul>
        <asp:Repeater runat="server" ID="ApplicationsRepeater">
            <ItemTemplate>
                <%-- the actual application should go here, main div id must match href of its tab --%>
                <div id='tab<%# Eval("ID") %>'>

		            <table>
                        <tr>
                            <td style="width:200px;">
                                <!-- State that the application is -->
                                <label for="State<%# Eval("ID") %>">State</label>
                                <div class="ui-widget App_Combobox">
                                    <select class="App_State" id="State<%# Eval("ID") %>"> 
		                                <option value="">Select a state...</option>
                                    </select>
                                    <div class="clear"></div>
                                    <input type="hidden" class="App_State_ID" value="<%# Eval("StateID") %>" />
                                    <input type="hidden" class="App_ID" value="<%# Eval("ID") %>" />
                                </div>
                            </td>
                            <td style="width:200px;">
                                <!-- Job Position -->
                                <label for="Position<%# Eval("ID") %>">Position</label>
                                <div class="ui-widget App_Combobox">
                                    <select class="App_Position" id="Position<%# Eval("ID") %>"> 
		                                <option value="">Select a position...</option>
                                    </select>
                                    <div class="clear"></div>
                                    <input type="hidden" class="App_Position_ID" value="<%# Eval("PositionID") %>" />
                                    <input type="hidden" class="App_ID" value="<%# Eval("ID") %>" />
                                </div>
                            </td>
                            <td>
                                <span class="ui-widget">
                                    Idle Since:
                                    <br />
                                    <%# Eval("StaleDate") %>
                                </span>
                            </td>
                        </tr>
                    </table>
                    
                    <DC:DocsControl ID="DocsControl1" runat="server" AppID='<%# Eval("ID") %>'></DC:DocsControl>

   	            </div>
            </ItemTemplate>
        </asp:Repeater>
    </div>
</asp:Content>
